package com.example.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2024-02-27
 * Time: 17:37
 */

@Controller
public class HelloController {


    @ResponseBody // 直接返回字符串，不要去找 ViewResolver 视图解析器
    @RequestMapping("/springmvc/hello") // 对 DispathcherServlet 访问到 HanderlerMapping 注册的注解
    public String hello() {
        System.out.println("HelloController.class");
        // 返回给前端
        return "hello springmvc!";
    }
}
